//
//  IndexSectionController.m
//  MY_IGList_demo
//
//  Created by mac on 2019/3/28.
//  Copyright © 2019 Yilian. All rights reserved.
//

#import "IndexSectionController.h"
#import"PersonCollectionViewCell.h"
#import "PersonModel.h"
@interface IndexSectionController()

@property (nonatomic, strong) PersonModel *model;

@end

@implementation IndexSectionController
- (instancetype)init {
    if (self = [super init]) {
        
        self.inset = UIEdgeInsetsMake(0, 0, 1, 0);
        
    }
    return self;
}

- (NSInteger)numberOfItems{
    return 1;
}

- (CGSize)sizeForItemAtIndex:(NSInteger)index{
    
    return CGSizeMake([[UIScreen mainScreen] bounds].size.width/3 - 1 ,[[UIScreen mainScreen] bounds].size.width/3 - 1);
}

- (__kindof UICollectionViewCell *)cellForItemAtIndex:(NSInteger)index{
    
    PersonCollectionViewCell *cell = [self.collectionContext dequeueReusableCellWithNibName:@"PersonCollectionViewCell" bundle:nil forSectionController:self atIndex:index];
    
    [cell setCellWithModel:self.model];
    return cell;
}

- (void)didUpdateToObject:(id)object{
    
    self.model = object;
}

@end
